export type UserRole = "guest" | "chef" | "diner";

export interface UserProfile {
  _id: string;
  _openid: string;
  account: string;
  nickname: string;
  avatarUrl: string;
  role: Exclude<UserRole, "guest">;
  createdAt: string;
}

export interface CategoryItem {
  key: string;
  name: string;
  color: string;
  icon?: string;
}

export interface MenuItem {
  _id: string;
  chefOpenId: string;
  categoryKey: string;
  name: string;
  description: string;
  coverUrl: string;
  stock: number;
  funValue: number;
  isActive: boolean;
  createdAt: string;
}

export type OrderStatus = "pending" | "accepted" | "rejected" | "cooking" | "completed";

export interface OrderLineItem {
  menuId: string;
  name: string;
  quantity: number;
  funValue: number;
}

export interface ReviewRecord {
  rating: number;
  comment: string;
  createdAt: string;
}

export interface OrderRecord {
  _id: string;
  chefOpenId: string;
  dinerOpenId: string;
  dinerNickname: string;
  note?: string;
  status: OrderStatus;
  items: OrderLineItem[];
  rejectReason?: string;
  createdAt: string;
  acceptedAt?: string;
  startedAt?: string;
  finishedAt?: string;
  rejectedAt?: string;
  closedAt?: string;
  review?: ReviewRecord;
}

export interface BootstrapResponse {
  envId: string;
  userProfile: UserProfile | null;
  categories: CategoryItem[];
  menu: MenuItem[];
  orders: OrderRecord[];
}
